<?php

class ErrorsCollector {

	private $arrErrors;

	public function __construct() {
		$this->arrErrors = array();
	}

	public function addError($str) {
		$this->arrErrors[] = $str;
	}

	public function hasErrors() {
		return !empty($this->arrErrors);
	}

//	public function getErrorsAsArray() {
//		return $this->arrErrors;
//	}

	public function getErrorsAsText() {
		return implode(', ', $this->arrErrors);
	}

	public function getErrorsAsHtmlList() {
        return '<ul><li>' . implode('</li><li>', $this->arrErrors) . '</li></ul>';
	}
}
?>